package com.kgc.service.impl;

import com.kgc.dao.ManagerMapper;
import com.kgc.pojo.Manager;
import com.kgc.pojo.ManagerExample;
import com.kgc.pojo.User;
import com.kgc.pojo.UserExample;
import com.kgc.service.GetMangerInfo_wzlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * 获得管理员信息
 * @author  王臻利
 */
@Service
public class GetManagerInfo_wzlServiceImpl implements GetMangerInfo_wzlService {

        @Autowired
        private ManagerMapper managerMapper;
        public Manager getManagerInfo(String username ,String password){
            ManagerExample userExample = new ManagerExample();
            userExample.createCriteria().andUsernameEqualTo(username).andPasswordEqualTo(password);
            List<Manager> users = managerMapper.selectByExample(userExample);
            if(users != null && users.size() > 0){
                return users.get(0);
            }
            return null;
        }
        /*获取管理员信息*/
        public  List<Manager> getManagerInfo_wzl(){
            ManagerExample managerExample =new ManagerExample();
            return managerMapper.selectByExample(managerExample);
        }
        /*删除管理员信息*/
        public  int deleManager_wzl(int id){
            return managerMapper.deleteByPrimaryKey(id);
        }
        /*增加管理员信息*/
        public int addManagerinfo_wzl(Manager manager){
            return managerMapper.insertSelective(manager);
        }
}
